home *** CD-ROM | disk | FTP | other *** search
/ Aminet 51 / Aminet 51 (2002)(GTI - Schatztruhe)[!][Oct 2002].iso / Aminet / gfx / fract / FlashMandelWOS.lha / FlashMandel / Developer / Modules / PPC / JulianPPC.P < prev    next >
Encoding:
Text File  |  2002-08-02  |  2.2 KB  |  73 lines

  1. **********************************************************************************************************************
  2. **            Written by Dino Papararo            12-December-2001
  3. **
  4. **  FUNCTION
  5. **
  6. **    JulianPPC -- perform  Z = (Z^(2^n)) + C  (1 <= n <= 11)
  7. **
  8. **  SYNOPSIS
  9. **
  10. **    ULONG JulianPPC (ULONG Iterations,ULONG Power,long double Cre,long double Cim,long double JKre,long double JKim)
  11. **
  12. **
  13. **  This function tests if a point belongs or not at Julia set
  14. **
  15. **  Optimized for pipelines of PPC processors.
  16. **
  17. **  r3:Iterations r4:Power
  18. **  f1:Cre/Zr f2:Cim/Zi f3:JKre f4:JKim f5:Zr2 f6:Zi2 f7:Dist f8:MaxDist
  19. **********************************************************************************************************************
  20.  
  21.  
  22.                 include powerpc/ppcmacros.i
  23.                 include powerpc/powerpc.i
  24.  
  25. ;                xref _PowerPCBase
  26.  
  27.                 xdef _JulianPPC
  28.  
  29.                 section code
  30.  
  31.                 cpu POWERPC
  32.  
  33. _JulianPPC
  34.  
  35.                  prolog             ; start
  36.  
  37.                  lf     f8,Radius   ; MaxDist = Radius
  38.                  b+     .Loop2      ; go to Loop2
  39.  
  40. .Loop1
  41.                  mfctr  r3          ; Iterations = Counter
  42. .Loop2
  43.                  mtctr  r4          ; Counter = Power
  44. .Loop3
  45.                  fmul   f6,f2,f2    ; zi2 = zi * zi
  46.                  fmul   f5,f1,f1    ; zr2 = zr * zr
  47.                  fmul   f2,f1,f2    ; zi = zr * zi
  48.                  fsub   f1,f5,f6    ; zr = zr2 - zi2
  49.                  fadd   f2,f2,f2    ; zi = zi + zi
  50.                  bdnz   .Loop3      ; if --Counter > 0 go to Loop3
  51.  
  52.                  mtctr  r3          ; Counter = Iterations
  53.                  fadd   f7,f5,f6    ; Dist = zr2 + zi2
  54.                  fadd   f1,f1,f3    ; zr = zr + JKre
  55.                  fadd   f2,f2,f4    ; zi = zi + JKim
  56.                  fcmpu  f7,f8       ; compare Dist with MaxDist
  57.                  bdnzf+ GT,.Loop1   ; if Dist < MaxDist and --Counter > 0 go to Loop1
  58. ****************************************************************************************
  59.  
  60. .End
  61.  
  62.                  mfctr  r3          ; Iterations = Counter
  63.  
  64.                  epilog             ; end
  65.  
  66.                 save
  67.                 data
  68.  
  69.              align.d
  70. Radius          dc.d   4.0
  71.  
  72.                 restore
  73.